package com.example.Lezedata.ui.fragment.home;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.example.Lezedata.dataModel.GoodsInfoModel;
import com.example.Lezedata.dataModel.GoodsProjectModel;

import java.util.ArrayList;

public class HomeWinnersViewModel extends ViewModel {
    MutableLiveData <ArrayList <GoodsProjectModel>> models = new MutableLiveData<ArrayList<GoodsProjectModel>>();

    public HomeWinnersViewModel(){
        loadData();
    }

    void loadData(){
        ArrayList<GoodsProjectModel> models = new  ArrayList<GoodsProjectModel>();
        for (int i = 0 ; i < 10 ; i ++){
            GoodsProjectModel projectModel = new GoodsProjectModel();
            projectModel.goodsPurchased = 30;
            GoodsInfoModel model = new GoodsInfoModel();
            model.goodsTotal = 100;
            model.goodsDetail = "苹果手机贼牛逼";
            model.goodsIcon = "https://c-ssl.duitang.com/uploads/item/201605/02/20160502073804_CBVhy.thumb.1000_0.jpeg";
            model.goodsName = "IPhone x";
            model.goodsPrice = 6399;
            projectModel.infoModel = model;
            models.add(projectModel);
        }
        this.models.setValue(models);
    }
}